/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86156
 * Date: 2022-03-13
 * Time: 7:43
 */
public class myArrayList {
    public void remove(int key) {
        if (this.head == null) {
            System.out.println('单链表为空!');
            return;
        }
        if (this.head.val == key) {
            this.head = this.head.next;
        }
        Listnode cur = this.head;
        while (cur.next.val != key) {
            cur = cur.next;
        }
        cur.next = cur.next.next;
    }
}
